package jhelp;

public class LocalworkController implements Controller {
	Model model;
	View view;
	
	public LocalworkController() {
		model = null;
		this.view = new Client(null, (Controller)this);
	}

	public void setModelDataSource(String source, String type){
		switch (type){
			case "file":
				model = new FileDataModel();
				model.setDataSource(source);
				
			break;
			case "xml":
				model = new XMLDataModel();
				model.setDataSource(source);
			break;
			case "db":
				model = new DBDataModel();
				model.setDataSource(source);
			break;
		}
		view.setObservable((Observable)model);
	}
	public void find(){
		model.findText(view.getTextToFind());
	}
}
